class GoogleController < ApplicationController

  # Metodo que redirecciona a la página de google openid cuando y devuelve a la página en el formulario de registro
  # de clientes
	def irgoogle

    @ip = obtencionip
    redirect_to "https://www.google.com/accounts/o8/ud
?openid.ns=http://specs.openid.net/auth/2.0
&openid.ns.pape=http://specs.openid.net/extensions/pape/1.0
&openid.ns.max_auth_age=300
&openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select
&openid.identity=http://specs.openid.net/auth/2.0/identifier_select
&openid.return_to=http://" + @ip + ":3000/clientes/new
&openid.realm=http://"+ @ip +":3000
&openid.assoc_handle=ABSmpf6DNMw
&openid.mode=checkid_setup
&openid.ui.ns=http://specs.openid.net/extensions/ui/1.0
&openid.ui.mode=popup
&openid.ui.icon=true
&openid.ns.ax=http://openid.net/srv/ax/1.0
&openid.ax.mode=fetch_request
&openid.ax.type.email=http://axschema.org/contact/email
&openid.ax.type.firstname=http://axschema.org/namePerson/first
&openid.ax.type.lastname=http://axschema.org/namePerson/last
&openid.ax.type.language=http://axschema.org/pref/language
&openid.ax.required=email,firstname,lastname,language"
	
	end

  # Método que redirecciona a google una vez que el cliente ya ha sido registrado en el sistema.
	
	def logingoogle


    @ip = obtencionip
    redirect_to "https://www.google.com/accounts/o8/ud
?openid.ns=http://specs.openid.net/auth/2.0
&openid.ns.pape=http://specs.openid.net/extensions/pape/1.0
&openid.ns.max_auth_age=300
&openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select
&openid.identity=http://specs.openid.net/auth/2.0/identifier_select
&openid.return_to=http://" + @ip + ":3000/sesion_clientes
&openid.realm=http://"+ @ip +":3000
&openid.assoc_handle=ABSmpf6DNMw
&openid.mode=checkid_setup
&openid.ui.ns=http://specs.openid.net/extensions/ui/1.0
&openid.ui.mode=popup
&openid.ui.icon=true
&openid.ns.ax=http://openid.net/srv/ax/1.0
&openid.ax.mode=fetch_request
&openid.ax.type.email=http://axschema.org/contact/email
&openid.ax.type.firstname=http://axschema.org/namePerson/first
&openid.ax.type.lastname=http://axschema.org/namePerson/last
&openid.ax.type.language=http://axschema.org/pref/language
&openid.ax.required=email,firstname,lastname,language"
  end



  def loginempleados


    @ip = obtencionip
    redirect_to "https://www.google.com/accounts/o8/ud
?openid.ns=http://specs.openid.net/auth/2.0
&openid.ns.pape=http://specs.openid.net/extensions/pape/1.0
&openid.ns.max_auth_age=300
&openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select
&openid.identity=http://specs.openid.net/auth/2.0/identifier_select
&openid.return_to=http://" + @ip + ":3000/sesion_empleados
&openid.realm=http://"+ @ip +":3000
&openid.assoc_handle=ABSmpf6DNMw
&openid.mode=checkid_setup
&openid.ui.ns=http://specs.openid.net/extensions/ui/1.0
&openid.ui.mode=popup
&openid.ui.icon=true
&openid.ns.ax=http://openid.net/srv/ax/1.0
&openid.ax.mode=fetch_request
&openid.ax.type.email=http://axschema.org/contact/email
&openid.ax.type.firstname=http://axschema.org/namePerson/first
&openid.ax.type.lastname=http://axschema.org/namePerson/last
&openid.ax.type.language=http://axschema.org/pref/language
&openid.ax.required=email,firstname,lastname,language"
  end
end

